unit MFU;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, AppEvnts;

type
  TMF = class(TForm)
    Timer: TTimer;
    InputBtn: TButton;
    ExceptionBtn: TButton;
    ApplicationEvents: TApplicationEvents;
    RndLabel: TLabel;
    procedure InputBtnClick(Sender: TObject);
    procedure ExceptionBtnClick(Sender: TObject);
    procedure TimerTimer(Sender: TObject);
    procedure ApplicationEventsException(Sender: TObject; E: Exception);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MF: TMF;

implementation

{$R *.dfm}

procedure TMF.ApplicationEventsException(Sender: TObject; E: Exception);
begin
  // Log
end;

procedure TMF.ExceptionBtnClick(Sender: TObject);
var
  Form: TForm;
begin
  Form := nil;
  Form.ShowModal();
end;

procedure TMF.InputBtnClick(Sender: TObject);
var
  S: string;
begin
  S := InputBox('Test', 'Please, input a value', '');
  // Log
end;

procedure TMF.TimerTimer(Sender: TObject);
var
  X: Integer;
begin
  X := Random(Random(1000));
  RndLabel.Caption := 'Random value = ' + IntToStr(X);
  // Log
end;

end.
